package com.activitycode.adapter;

import java.util.List;

import com.duostec.zhuyue.pets.R;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

public class ChoosePositionAdapter extends BaseAdapter{
	
	public Context context;
	private List<String> bussNameList;
	private List<String> busaddressList;
	
	
	public ChoosePositionAdapter(Context context,List<String> bussNameList,List<String> busaddressList) {
		// TODO Auto-generated constructor stub
		this.context = context;
		this.bussNameList = bussNameList;
		this.busaddressList = busaddressList;
	}
	

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return bussNameList.size();
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return bussNameList.get(position);
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		ViewHolder viewHolder;
		if(convertView == null){
			convertView = LayoutInflater.from(context).inflate(
					R.layout.adapter_choose_position, null);
			viewHolder = new ViewHolder();
			viewHolder.nameString = (TextView)convertView.findViewById(R.id.bussniss_name);
			viewHolder.addressString = (TextView)convertView.findViewById(R.id.bussniss_address);
		
			convertView.setTag(viewHolder);
	}else{
		viewHolder = (ViewHolder) convertView.getTag();
	}
		viewHolder.nameString.setText(bussNameList.get(position));
		viewHolder.addressString.setText(busaddressList.get(position));
		return convertView;
	

}
	final static class ViewHolder{
		TextView nameString;
		TextView addressString;
		
	}
}